package cc.lucien.converter;

import cc.lucien.entity.Student;
import org.springframework.core.convert.converter.Converter;

/**
 * @author lucien-ma
 * @date 2021/9/7
 * @apiNote
 */
public class StudentConverter implements Converter<String, Student> {
    @Override
    public Student convert(String source) {
        String[] args = source.split("-");
        Student student = new Student();
        student.setId(Integer.parseInt(args[0]));
        student.setName(args[1]);
        student.setAge(Integer.parseInt(args[2]));
        return student;
    }
}
